package com.hello.system.service.impl;

import java.util.List;
import com.hello.common.core.utils.DateUtils;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hello.system.mapper.RentalMemberAddressesMapper;
import com.hello.system.domain.RentalMemberAddresses;
import com.hello.system.service.IRentalMemberAddressesService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * 会员地址Service业务层处理
 * 
 * @author hello
 * @date 2025-07-20
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class RentalMemberAddressesServiceImpl extends ServiceImpl<RentalMemberAddressesMapper, RentalMemberAddresses> implements IRentalMemberAddressesService 
{
    private final RentalMemberAddressesMapper rentalMemberAddressesMapper;

    /**
     * 查询会员地址
     * 
     * @param addressId 会员地址主键
     * @return 会员地址
     */
    @Override
    public RentalMemberAddresses selectRentalMemberAddressesByAddressId(Long addressId)
    {
        return rentalMemberAddressesMapper.selectRentalMemberAddressesByAddressId(addressId);
    }

    /**
     * 查询会员地址列表
     * 
     * @param rentalMemberAddresses 会员地址
     * @return 会员地址
     */
    @Override
    public List<RentalMemberAddresses> selectRentalMemberAddressesList(RentalMemberAddresses rentalMemberAddresses)
    {
        return rentalMemberAddressesMapper.selectRentalMemberAddressesList(rentalMemberAddresses);
    }

    /**
     * 新增会员地址
     * 
     * @param rentalMemberAddresses 会员地址
     * @return 结果
     */
    @Override
    public int insertRentalMemberAddresses(RentalMemberAddresses rentalMemberAddresses)
    {
        rentalMemberAddresses.setCreateTime(DateUtils.getNowDate());
        return rentalMemberAddressesMapper.insertRentalMemberAddresses(rentalMemberAddresses);
    }

    /**
     * 修改会员地址
     * 
     * @param rentalMemberAddresses 会员地址
     * @return 结果
     */
    @Override
    public int updateRentalMemberAddresses(RentalMemberAddresses rentalMemberAddresses)
    {
        rentalMemberAddresses.setUpdateTime(DateUtils.getNowDate());
        return rentalMemberAddressesMapper.updateRentalMemberAddresses(rentalMemberAddresses);
    }


    /**
     * 批量删除会员地址
     * 
     * @param addressIds 需要删除的会员地址主键
     * @return 结果
     */
    @Override
    public int deleteRentalMemberAddressesByAddressIds(Long[] addressIds)
    {
        return rentalMemberAddressesMapper.deleteRentalMemberAddressesByAddressIds(addressIds);
    }

    /**
     * 删除会员地址信息
     * 
     * @param addressId 会员地址主键
     * @return 结果
     */
    @Override
    public int deleteRentalMemberAddressesByAddressId(Long addressId)
    {
        return rentalMemberAddressesMapper.deleteRentalMemberAddressesByAddressId(addressId);
    }

    /**
     * 根据用户ID查询会员地址列表
     * 
     * @param userId 用户ID
     * @return 会员地址集合
     */
    @Override
    public List<RentalMemberAddresses> selectRentalMemberAddressesByUserId(Long userId)
    {
        return rentalMemberAddressesMapper.selectRentalMemberAddressesByUserId(userId);
    }
}
